import request from '@/router/axios';
import { baseUrl,baseUrls } from '@/config/env';
export const loginByUsername = (username, password) => request({
    url: baseUrls + '/login',
    method: 'post',
    meta: {
        isToken: false
    },
    data: {
        userName: username,
        passWord: password,
    }
})
// export const loginByUsername = (username, password, code, redomStr) => request({
//     url: baseUrl + '/user/login',
//     method: 'post',
//     meta: {
//         isToken: false
//     },
//     data: {
//         username,
//         password,
//         code,
//         redomStr
//     }
// })

export const getUserInfo = () => request({
    url: baseUrl + '/user/getUserInfo',
    method: 'get'
});

export const refeshToken = () => request({
    url: baseUrl + '/user/refesh',
    method: 'post'
})

// 根据权限获取左侧菜单
export const getMenu = (type = 0) => request({
    url: baseUrl + '/user/getMenu',
    method: 'get',
    data: {
        type
    }
});

export const getTopMenu = () => request({
    url: baseUrl + '/user/getTopMenu',
    method: 'get'
});

export const sendLogs = (list) => request({
    url: baseUrl + '/user/logout',
    method: 'post',
    data: list
})

// 退出登录
export const logout = () => request({
    url: baseUrl + '/user/logout',
    meta: {
        isToken: false
    },
    method: 'get'
})